<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="author" content="m.jd.com">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css"
          href="/resources/wap/css/base2013.css" charset="gbk" />
    <link rel="stylesheet" type="text/css"
          href="/resources/wap/css/my.css?r=2" charset="gbk" />
    <link rel="stylesheet" type="text/css"
          href="/resources/wap/css/header.css" charset="gbk" />
    <script src="/resources/js/jquery-1.11.1.min.js"></script>
    <script src="/resources/js/self.js?r=2"></script>
    <style type="text/css">
        .padding_top{padding-top: 11px;}
        .orderStatistics{height:12.5px !important;}
        .line{
            margin-top: 10px;
            padding: 10px;
        }
        .line label{
            display: block;
            float: left;
            width: 30%;
        }
        .line div{
            width: 70%;
            float: right;
        }


    </style>
    <title>Title</title>
</head>
<body>
<header>
    <!-- 通用头 div -->
    <div id="m_common_header" style="min-height: 45px; margin-top: 0px;">
        <header class="jd-header">
            <div class="jd-header-bar">
                <div id="m_common_header_goback" class="jd-header-icon-back J_ping" onclick="javascript:window.location.href='/pages/wx/index.jsp';">
                    <span></span>
                </div>
                <div class="jd-header-title" style="max-width: 640px;margin: 0 auto">
                    客户级别
                </div>
            </div>
        </header>
    </div>
</header>
<a name="top"></a>
<div class="common-wrapper">
    <input type="hidden" class="form-data" name="id">
    <div class="myJD-content">
        <div class="product-title" style=" background: #fff;padding: 10px; border-radius: 10px" >

            <div style="width:100%;float: left;margin-left:4%;">
                <div class="line">

                    <label>等级名称：</label>
                    <div>
                        <input name="name" class="form-data" />
                    </div>
                </div>
                <div class="line">
                    <label>排序：</label>
                    <div>
                        <input name="sort" class="form-data" />
                    </div>

                </div>
                <div class="line">
                    <label>是否默认：</label>
                    <div>
                        <input style="width:15px;height:15px" type="radio" name="defaultSet" class="form-data" value="1" />
                        <span>默认</span>
                        <input style="width:15px;height:15px" type="radio" name="defaultSet" class="form-data" value="-1"
                           checked="checked"
                        />
                        <span>非默认</span>
                    </div>

                </div>
                <div class="line">
                    <label>描述：</label>
                    <div>
                        <textarea name="name" class="form-data" rows="7"  style="width: 100%"></textarea>
                    </div>

                </div>

            </div>
            <div style="clear: both;">

            </div>
            <div align="center" style="margin-top: 30px;">
                <a style="background:#12B9DB;width: 200px;height: 40px;padding: 10px;border-radius: 5px;"
                   href="javascript:void(0)" onclick="save()">提交</a>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    $(function () {
        loadData();
    });
    function loadData() {
        var id =  getUrlParam("id");
        if(null2empty(id) !==""){
            $("[name='id']").val(id);
            $.ajax({
                url:"/wap/supplier/customerLevel/find.do",
                data:{'id':id},
                type:'post',
                dataType:'json',
                success:function(data){
                    console.log(data);
                    if(data.success){
                        if(!isNullOrUndefined(data.data)){
                            initPageDate(data.data, '.form-data');
                        }

                    }
                }
            });
        }

    }
    function save() {
        var params = getPageDataByClass("form-data");
        if (strIsNull(params['name'])) {
            alert("请输入名称");
            return;
        }

        $.ajax({
            url: "/wap/supplier/customerLevel//save.do",
            data: params,
            dataType: 'json',
            type: 'post',
            success: function (data) {
                console.log(data);
                if (data.success) {
                    alert("保存成功");
                    pageGoto("customer_level_list.html");
                } else {
                    alert(data.msg);
                }
            }
        });
    }
</script>
</html>